package test;

import dto.Dice;
import ie.Shaker;

public class TShaker extends Shaker{

	private int diceSum;
	private dto.Dice[] dices;
	
	public TShaker(int numberOfDices, int sides) {
		dices = new Dice[numberOfDices];
		for (int i = 0; i<numberOfDices; i++) dices[i] = new Dice(sides);
	}
	
	public void setDices(int num1, int num2){
		while (dices[0].getValue() != num1 || dices[1].getValue() != num2) {
			dices[0].generateDice();
			dices[1].generateDice();
		}
	}
	
	@Override
	public Dice[] shake() {
		return dices;
	}
	
	@Override
	public int getDiceSum() {
		diceSum = 0;
		for (int i = 0; i < dices.length; i++) {
			diceSum += dices[i].getValue();
		}
		return diceSum;
	}
	
	@Override
	public Dice[] getDices() {
		return dices;
	}
}


